import Vue from 'vue'
import VueRouter from 'vue-router'
import Footer from '@/components/footer.vue'
Vue.use(VueRouter)

const routes = [
  { // 重定向
    path: '/',
    redirect: '/start'
  },
  { // 引导页
    path: '/start',
    name: 'start',
    components: {
      default: () => import('@/views/start/index')
    }
  },
  { // 首页
    path: '/home',
    name: 'home',
    components: {
      default: () => import('@/views/home/index'),
      footer: Footer
    }
  },
  { // 切换账号页面
    path: '/switchAccount',
    name: 'switchAccount',
    components: {
      default: () => import('@/views/home/switchAccount')
    }
  },
  { // 宝宝日记
    path: '/note',
    name: 'note',
    components: {
      default: () => import('@/views/home/note/index')
    }
  },
  { // 宝宝日记详情
    path: '/notedetail',
    name: 'notedetail',
    components: {
      default: () => import('@/views/home/note/notedetail')
    }
  },
  { // 添加日记
    path: '/addnote',
    name: 'addnote',
    components: {
      default: () => import('@/views/home/note/addnote')
    }
  },
  { // 成长记录
    path: '/growthrecord',
    name: 'growthrecord',
    components: {
      default: () => import('@/views/home/GrowthRecord/index')
    }
  },
  { // 百科
    path: '/kind',
    name: 'kind',
    components: {
      default: () => import('@/views/kind/index'),
      footer: Footer
    }
  },
  { // 菜谱
    path: '/menu',
    name: 'menu',
    components: {
      default: () => import('@/views/menu/index'),
      footer: Footer
    }
  },
  { // 我的
    path: '/user',
    name: 'user',
    components: {
      default: () => import('@/views/user/index'),
      footer: Footer
    }
  },
  { // 登录
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '*',
    name: 'notfound',
    component: () => import('@/views/notfound/index.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  // mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
